package com.xyd.controller;

import com.xyd.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@RequestMapping("/free")
@Controller
public class FreeController {

    @RequestMapping("/index")
    public String toIndex(Model model) {
        /*User user = new User();
        user.setName("李四");
        user.setPassword("12333");
        user.setHiredate(new Date());
        model.addAttribute("user", user);*/

        User u1 = new User(1, "张三");
        User u2 = new User(2, "李四");
        User u3 = new User(3, "王五");
        User u4 = new User(4, "赵六");
        List<User> list = new ArrayList<>();
        list.add(u1);
        list.add(u2);
        list.add(u3);
        list.add(u4);
        model.addAttribute("list", list);
        return "index";
    }
}
